// Playground - noun: a place where people can play

import Cocoa


/*********************************************************************
 * The Swift Language Learning  Chapter 07: Enumerations
 *********************************************************************/


enum CompassPoint {
	case North
	case South
	case East
	case West
}

var direction = CompassPoint.West
direction = .East


//assosiated value
enum Barcode {
	case UPCA(Int,Int,Int)
	case QRCode(String)
}

var productBarCode = Barcode.UPCA(1, 2, 3)
productBarCode = Barcode.QRCode("code")


//raw value
enum ASCIIControlCharacter: Character {
	case Tab = "\t"
	case LineFeed = "\n"
	case CarriageReturn = "\r" //if equal to 3, error, every value shoule be Character
}

let a = ASCIIControlCharacter.Tab //must write ASCIIControlCharacter for raw Value
let aRow = ASCIIControlCharacter.Tab.toRaw()

enum Planet: Int {
	case Mercury = 1, Venus,Earth,Mars,Moon
}

var pla = Planet.Mercury
var plaRow = Planet.Mercury.toRaw()

var any = Planet.fromRaw(3) //chang to 6 see what happens
if any == Planet.Earth {
	var out = "earth"
}













